
#include "iostream"
#include "vector"
#include "unordered_map"
#include "unordered_set"
#include "algorithm"
#include "string"
#include "list"
#include "string.h"

struct Car{
};
class Solution{
public:
    std::string in_offers( std::vector<std::string> vec,std::string f){
        for(auto &s:vec){
            int ind=s.find(f);
            if(ind>-1){
                return s;
            }
        }
        return "";
    }
    void run(){

        bool first= true;
        int a,b;
        while(std::cin>>a>>b){
            while((char)std::cin.get()!='\n'){
            }
            std::vector<std::string> wants;
            std::vector<std::string> offers;
            for(int i=0;i<a;i++){
                std::string want;
                std::getline(std::cin,want);
                wants.push_back(want);
            }
            for(int i=0;i<b;i++){
                std::string offer;
                std::getline(std::cin,offer);
                offers.push_back(offer);
            }
            int cnt=0;
            for(auto &w:wants){
                auto s=in_offers(offers,w);
                if(s.size()>0){
                    cnt++;
                    std::cout<<s<<std::endl;
                }
            }
            if(cnt==0){
                printf("Not found!\n");
            }
        }
    }
};

int main() {
//    bool cur_num= true;
Solution().run();
    return 0;
}

